package controller;

public class CourseSession {
	public Integer start;
	public Integer end;
	public String day;
	public String name;
	
	public CourseSession(String start,String end,String day,String name)
	{
		this.day=day;
		this.start=Integer.parseInt(start);
		this.end=Integer.parseInt(end);
		this.name=name;
	}
	
	public CourseSession(Integer start, Integer end, String day, String name) {
		this.day=day;
		this.start=start;
		this.end=end;
		this.name=name;
	}

	public boolean collideWith(CourseSession session)
	{
		if(!day.equals(session.getDay()))
			return false;
		if(start<session.getStart() && session.getStart()<end)
		{
			return true;
		}
		if(start<session.getEnd() && session.getEnd()<end)
		{
			return true;
		}
		if(session.getStart()<start && start<session.getEnd())
		{
			return true;
		}
		if(session.getStart()<end && end<session.getEnd())
		{
			return true;
		}
		if (session.getStart()==start && session.getEnd()==end){
			return true;
		}
		return false;
	}

	public String getDay() {
		return day;
	}

	public int getStart() {
		return start;
	}

	public int getEnd() {
		return end;
	}
	
	public String getName(){
		return name;
	}
}
